package net.pluce.nxt.network.impl;

import net.pluce.nxt.network.DirectionMessage;
import net.pluce.nxt.network.DistanceMessage;

/**
 * Default implementation of message logic. It implements distance and direction message, using 3 int fields.
 * @author Pluce
 *
 */
public class Message implements DistanceMessage, DirectionMessage {
	private int type;
	private int firstParameter;
	private int secondParameter;
	
	public Message(int type, int firstParameter, int secondParameter) {
		super();
		this.type = type;
		this.firstParameter = firstParameter;
		this.secondParameter = secondParameter;
	}

	/**
	 * Returns the raw message
	 * @return an array of 3 int
	 */
	public int[] getRawMessage(){
		int[] retour = {type,firstParameter,secondParameter};
		return retour;
	}

	@Override
	public int getDirection() {
		return firstParameter;
	}

	@Override
	public int getColor() {
		return secondParameter;
	}

	@Override
	public int getDistance() {
		return firstParameter;
	}

	@Override
	public int getTime() {
		return secondParameter;
	}
}
